import BaseModel from "../../../cfw/mvc/BaseModel";
import ModelManager from "../../../cfw/mvc/ModelManager";

import ClotheTypeModel from "./ClotheTypeModel";
import ModuleManager from "../../../cfw/module/ModuleManager";
import ClotheItemModel from "./ClotheItemModel";

export default class ClotheManager extends BaseModel {


    private static ins: ClotheManager;

    static instance() {
        if (!this.ins) {
            this.ins = new ClotheManager()
        }
        return this.ins;
    }



    protected clotheMgr: ModelManager<ClotheItemModel> = new ModelManager();

    protected clotheType: ModelManager<ClotheTypeModel> = new ModelManager();



    getClothe(id: number) {
        return this.clotheMgr.getByID(id)
    }

    getClotheType(typeID: number) {
        return this.clotheType.getByID(typeID)
    }

    getClotheData() {
        return this.clotheMgr.getData()
    }

    constructor() {
        super();



        this.clotheMgr.initWithData(ModuleManager.dataManager.get(ClotheItemModel.CLASS_NAME), ClotheItemModel)

        this.clotheType.initWithData(ModuleManager.dataManager.get(ClotheTypeModel.CLASS_NAME),ClotheTypeModel)





    }
}
